import bus from './bus'

const baseUrl = process.env.VUE_APP_API_BASE_URL
/**
 * 基础模块接口定义
 */
const api = {
  //网络请求成功状态值
  HTTP_OK_STATUS: 100,
  Login: '/base/login/token',
  Logout: '/auth/logout',
  ForgePassword: '/auth/forge-password',
  Register: '/auth/register',
  twoStepCode: '/auth/2step-code',
  SendSms: '/account/sms',
  SendSmsErr: '/account/sms_err',
  // get my info
  UserInfo: '/user/info',
  common: {
    showState: [{ label: '禁用', value: 0 }, { label: '启用', value: 1 }],
    sexType: [{ label: '女', value: 0 }, { label: '男', value: 1 }],
    userStatus: [{ label: '正常', value: 1 }, { label: '禁用', value: 0 }],
    dictDataType: [{ label: '字符串', value: 1 }, { label: '数组', value: 2 }],
    ossType: [{ label: '本地服务器', value: 'LOCAL_OSS' }, { label: '阿里云', value: 'ALI_OSS' }],
    pushType: [{ label: '极光', value: 'PUSH_JG' }],
    imType: [{ label: '融云', value: 'IM_RONGCLOUD' }],
    displayState: [{ label: '显示', value: true }, { label: '隐藏', value: false }],
    authState: [{ label: '否', value: 0 }, { label: '是', value: 1 }],
    menuLayout: [{ label: 'PageView', value: 'PageView' }, { label: 'RouteView', value: 'RouteView' }],
    auditState: [{ label: '待审核', value: 1 }, { label: '通过', value: 2 }, { label: '退回', value: 10 }]
  },
  config: {
    oss: 'base/config/oss',
    ossSave: 'base/config/ossSave',
    pushSave: 'base/config/pushSave',
    sms: 'base/config/sms',
    get: 'base/config/get',
    smsSave: 'base/config/smsSave',
    saveIm: 'base/config/saveIm',
    globalConfigSave: 'base/config/globalConfigSave'
  },
  collecon:{
    totalByTargetEntity:'base/collecon/totalByTargetEntity',
  },
  suk: {
    page: 'base/suk/page'
  },
  baseApi: {
    page: 'base/api/page',
    add: 'base/api/add',
    update: 'base/api/update',
    remove: 'base/api/remove',
    all: 'base/api/all',
    batchRemove: 'base/api/batch/remove',
    batchUpdateOpen: 'base/api/batch/update/open',
    batchUpdateStatus: 'base/api/batch/update/status',
    setAuthState: 'base/api/setAuthState'
  },
  /**
   * 网关
   */
  gateway: {
    list: 'base/gateway/list'
  },
  menu: {
    add: 'base/menu/add',
    update: 'base/menu/update',
    list: 'base/menu/all',
    setState: 'base/menu/setState',
    remove: 'base/menu/remove'
  },
  payconfig: {
    page: 'base/payconfig/page',
    setPayStatus: 'base/payconfig/setPayStatus',
    setIsTest: 'base/payconfig/setIsTest',
    update: 'base/payconfig/update'
  },
  balance: {
    page: 'base/pay/balance/page',
    list: 'base/pay/balance/list',
    add: 'base/pay/balance/save',
    exportUrl: 'base/pay/balance/export',
    update: 'base/pay/balance/update',
    remove: 'base/pay/balance/remove'
  },
  balanceLog: {
    page: 'base/pay/pbl/page',
    list: 'base/pay/pbl/list',
    add: 'base/pay/pbl/save',
    exportUrl: 'base/pay/pbl/export',
    update: 'base/pay/pbl/update',
    remove: 'base/pay/pbl/remove'
  },
  file: {
    upload: baseUrl + '/base/file/upload',
    remove: 'base/file/remove',
    list: 'base/file/list'
  },
  area: {
    getPro: 'base/area/getPro',
    getCity: 'base/area/getCity',
    getArea: 'base/area/getArea',
    getAreaAll: '/api/area/all'
  },
  //后台管理用户
  managerUser: {
    page: 'base/manager/user/page',
    add: 'base/manager/user/add',
    remove: 'base/manager/user/remove',
    setStatus: 'base/manager/user/setStatus',
    update: 'base/manager/user/update',
    setRole: 'base/manager/user/setRole',
    password: 'base/manager/user/update/password',
    userStatus: [{ label: '正常', value: 1 }, { label: '禁用', value: 0 }],
    userType: [{ label: '超级管理员', value: 'super' }, { label: '普通管理员', value: 'normal' }]
  },
  //前台APP用户
  frontUser: {
    page: 'base/front/user/page',
    add: 'base/front/user/add',
    get: 'base/front/user/get',
    remove: 'base/front/user/remove',
    setStatus: 'base/front/user/setStatus',
    update: 'base/front/user/update',
    password: 'base/front/user/resetPwd'
  },
  appAccount: {
    page: 'base/front/account/page',
    add: 'base/front/account/add',
    remove: 'base/front/account/remove',
    update: 'base/front/account/update',
    password: 'base/front/account/update/password'
  },
  company: {
    page: 'base/company/page',
    add: 'base/company/add',
    get: 'base/company/get',
    setAuditState: 'base/company/setAuditState',
    setRecommend: 'base/company/setRecommend',
    update: 'base/company/edit',
    remove: 'base/company/delete',
    authStatus: [{ label: '未认证', value: 0 }, { label: '待审核', value: 1 }, { label: '已认证', value: 2 }, { label: '审核失败', value: 3 }]
  },
  shop: {
    page: 'base/shop/page',
    add: 'base/shop/add',
    get: 'base/shop/get',
    setShopState: 'base/shop/setShopState',
    list: 'base/shop/list',
    setAuditState: 'base/shop/setAuditState',
    setRecommend: 'base/shop/setRecommend',
    update: 'base/shop/edit',
    remove: 'base/shop/remove',
    shopState2: [{ label: '上架', value: 2 }, { label: '违规下架', value: 10 }],
    shopState: [{ label: '未审核', value: 0 }, { label: '已上架', value: 2 }, { label: '违规下架', value: 10 }]
  },
  //店铺分类
  shopType: {
    list: 'api/system/type/list',
    page: 'api/system/type/page',
    add: 'api/system/type/save',
    get: '/api/system/type/get',
    delete: 'api/system/type/delete',
    update: '/api/system/type/update'
  },
  dict: {
    initDict: 'base/dict/initDict',
    list: 'base/dict/list',
    add: 'base/dict/add',
    update: 'base/dict/update',
    remove: 'base/dict/delete'
  },
  html: {
    list: 'base/html/list',
    add: 'base/html/save',
    update: 'base/html/update',
    remove: 'base/html/delete'
  },
  dictData: {
    page: 'base/dictdata/page',
    add: 'base/dictdata/add',
    setState: 'base/dictdata/setState',
    update: 'base/dictdata/update',
    setUser: 'base/dictdata/users/add',
    remove: 'base/dictdata/remove',
    dicStatus: [{ label: '启用', value: 1 }, { label: '禁用', value: 0 }]
  },

  role: {
    page: 'base/role/page',
    add: 'base/role/add',
    update: 'base/role/update',
    listByType: function(roleType) {
      return `base/role/listByType/${roleType}`
    },
    setUser: 'base/role/users/add',
    remove: 'base/role/remove'
  },
  bbsContent: {
    page: 'api/bbs/content/page',
    add: 'api/bbs/content/save',
    setState: 'api/bbs/content/setState',
    get: 'api/bbs/content/get',
    update: 'api/bbs/content/update',
    remove: 'api/bbs/content/delete'
  },
  bbsComment: {
    page: 'api/bbs/comment/page',
    get: 'api/bbs/comment/get',
    delete: '/api/bbs/comment/delete'
  },
  avmVideo: {
    page: 'api/avm/video/page',
    update: 'base/avm/video/update',
    setState: 'api/avm/video/setState',
    get: 'api/avm/video/get',
    delete: 'api/avm/video/delete'
  },
  avmVideoComment: {
    page: 'api/avm/avc/page',
    get: 'api/avm/avc/get',
    delete: 'api/avm/avc/delete'
  },
  cmsContent: {
    page: 'base/cms/content/page',
    add: 'base/cms/content/save',
    setState: 'base/cms/content/setState',
    get: 'api/cms/content/get',
    update: 'base/cms/content/update',
    remove: 'base/cms/content/delete'
  },
  cmsComment: {
    page: 'base/cms/comment/page',
    delete: '/api/cms/comment/delete'
  },
  inteActivity: {
    page: 'base/interact/activity/page',
    delete: 'base/interact/activity/delete',
    get: 'base/interact/activity/get',
    add: 'base/interact/activity/save',
    update: 'base/interact/activity/update',
    setRecommend: 'base/interact/activity/setRecommend',
    setState: 'base/interact/activity/setState'
  },
  coupon: {
    page: '/api/coupon/page',
    delete: '/api/coupon/delete',
    get: '/api/coupon/get',
    add: '/api/coupon/save',
    update: '/api/coupon/update'
  },
  link: {
    page: 'base/link/page',
    add: 'base/link/add',
    setSendStatus: 'base/link/setSendStatus',
    update: 'base/link/update',
    remove: 'base/link/delete'
  },
  version: {
    page: 'base/version/page',
    add: 'base/version/save',
    get: 'base/version/get',
    setForceUpdate: 'base/version/setForceUpdate',
    update: 'base/version/update',
    remove: 'base/version/delete'
  },

  feedback: {
    page: 'base/feedback/page',
    get: 'base/feedback/get',
    setState: 'base/feedback/setState',
    update: 'base/feedback/update',
    remove: 'base/feedback/delete'
  },
  authority: {
    user: 'base/authority/user/grant',
    role: 'base/authority/role/grant'
  },
  brand: {
    page: 'base/brand/page',
    setRecommend: 'base/brand/setRecommend',
    add: 'base/brand/add',
    update: 'base/brand/update',
    delete: 'base/brand/delete',
    get: 'base/brand/get'
  },
  marketing: {
    page: 'base/product/marketing/page',
    update: 'base/product/marketing/update',
    remove: 'base/product/marketing/delete',
    batchAdd: 'base/product/marketing/batchAdd'
  },
  product: {
    add: 'base/product/add',
    page: 'base/product/page',
    setOnLineState: 'base/product/setOnLineState',
    setRecommend: 'base/product/setRecommend',
    getSkuList: 'base/product/sku/list',
    remove: 'base/product/remove',
    update: 'base/product/update',
    totalProduct: 'base/product/totalProduct',
    get: 'base/product/get'
  },
  topic: {
    page: 'base/product/topic/page',
    get: 'base/product/topic/get',
    add: 'base/product/topic/save',
    setState: 'base/product/topic/setState',
    update: 'base/product/topic/update',
    topicType: [{ label: '限时秒杀', value: 2 }, { label: '限时抢购', value: 1 }, { label: '每周精选', value: 3 }],
    remove: 'base/product/topic/delete'
  },
  specs: {
    page: 'base/specs/page',
    add: 'base/specs/save',
    setState: 'base/specs/setState',
    update: 'base/specs/update',
    remove: 'base/specs/delete',
    specsType: [{ label: '文本', value: 2 }, { label: '颜色', value: 1 }]
  },
  type: {
    list: 'base/system/type/list'
  },
  //消息类型
  msgType: {
    setTypeState: 'base/msg/type/setTypeState',
    setSortOrder: 'base/msg/type/setSortOrder',
    page: 'base/msg/type/page',
    list: 'base/msg/type/list',
    add: 'base/msg/type/save',
    update: 'base/msg/type/update',
    pushDeviceType: [{ label: '全部', value: 0 }, { label: 'Android', value: 1 }, { label: 'IOS', value: 2 }],
    sendType: [{ label: '立即发送', value: 0 }],
    remove: 'base/msg/type/remove'
  },
  //消息内容
  content: {
    setMsgState: 'base/msg/content/setMsgState',
    page: 'base/msg/content/page',
    add: 'base/msg/content/save',
    get: 'base/msg/content/get',
    update: 'base/msg/content/update',
    remove: 'base/msg/content/remove'
  },
  //订单管理
  order: {
    page: 'base/order/listByShop',
    cancel: 'base/order/cancel',
    remove: 'base/order/delete',
    update: 'base/order/update',
    totalSaleByType: 'base/order/totalSaleByType',
    getSaleByCateGory: 'base/order/getSaleByCateGory',
    getTotalData: 'base/order/getTotalData',
    countByOrderState: 'base/order/countByOrderState',
    get: 'base/order/get'
  },
  settle: {
    exportUrl: 'base/order/export',
    page: 'base/order/totalSale',
    totalSaleByShop: 'base/order/totalSaleByShop'
  },
  //订单明细
  orderDetails: {
    list: 'base/order/details/list'
  },
  //订单物流
  orderLogistics: {
    get: 'base/order/logistics/get',
    update: 'base/order/logistics/update'
  },
  //发票
  invoice: {
    page: 'base/invoice/page',
    get: 'base/invoice/get',
    remove: 'base/invoice/remove',
    update: 'base/invoice/update',
    invoiceState: [{ label: '已开', value: 1 }, { label: '未开', value: 0 }]
  },
  logistics: {
    list: 'base/logistics/list',
    page: 'base/logistics/page',
    add: 'base/logistics/save',
    get: 'base/logistics/get',
    update: 'base/logistics/update',
    remove: 'base/logistics/delete'
  },
  //售后保障
  aftersale: {
    page: 'base/product/aftersale/page',
    add: 'base/product/aftersale/save',
    get: 'base/product/aftersale/get',
    setState: 'base/product/aftersale/setState',
    update: 'base/product/aftersale/update',
    remove: 'base/product/aftersale/delete'
  },
  //售后服务
  afterService: {
    page: 'base/order/afterservice/page',
    update: 'base/order/afterservice/update',
    remove: 'base/order/afterservice/delete',
    serviceType: [{ label: '维修', value: 1 }, { label: '退货', value: 2 }, { label: '换货', value: 3 }]
  },
  //售后原因
  cause: {
    list: 'base/order/cause/list'
  },
  //订单评价
  evaluate: {
    page: 'base/order/evaluate/page',
    remove: 'base/order/evaluate/delete'
  },
  //商品分类
  category: {
    first: 'base/product/category/first',
    add: 'base/product/category/add',
    update: 'base/product/category/edit',
    remove: 'base/product/category/remove',
    list: 'base/product/category/list',
    second: 'base/product/category/second'
  },
  //商品规格模板
  specscategory: {
    getSpecsCategory: 'base/specscategory/getSpecsCategory',
    add: 'base/specscategory/add',
    update: 'base/specscategory/update'
  },
  //银行账户
  bank: {
    page: 'base/system/bank/page',
    add: 'base/system/bank/save',
    saveOrUpdate: 'base/system/bank/saveOrUpdate',
    get: 'base/system/bank/get',
    update: 'base/system/bank/update',
    remove: 'base/system/bank/delete'
  },
}
const all = Object.assign({}, api, bus)
export default all
